package com.rosesoft.frame.action;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @FileName BaseAction.java
 * @Description: 
 * @author rose
 * @version 1.0
 * <p>Company: ROSE-SOFT</p>
 * <p>Copyright: Copyright (c) 2011</p>
 */
public class BaseAction extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

	}

	public void init() throws ServletException {
	}
	
	public String getParameter(HttpServletRequest request, String paramName){
		if ("".equals(paramName) || paramName == null) return "";
		if ("".equals(paramName.trim())) return "";
		String parameter = "";
		parameter = request.getParameter(paramName.trim());
		 try {
			if((!parameter.equals(new String(parameter.getBytes("UTF-8"), "UTF-8")))) {
				parameter = new String(parameter.getBytes("iso8859-1"), "UTF-8");
			 }
		} catch (Exception e) {
			e.printStackTrace();
		}
		return parameter;
	}

}
